package com.example.demo.service;

import com.example.demo.bean.UserBean;
import com.example.demo.event.UserRegisterEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

/**
 * @author ml
 * @create 2017-08-02--17:04
 */
@Service
public class UserService {

    @Autowired
    ApplicationContext applicationContext;

    public void register(UserBean userBean){
        //。。。省略其他业务逻辑
        //发布UserRegisterEvent事件
        applicationContext.publishEvent(new UserRegisterEvent(this,userBean));
    }
}
